﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Sharp.DataTransferObject;
using Sharp.Infrastructure;
using Sharp.Infrastructure.Communication;
using Sharp.Platform.Mvc;
using Sharp.ServiceContracts;
using Sharp.WebBooter.Areas.Platform.Models;

namespace Sharp.WebBooter.Areas.Platform.Controllers
{
    [AutomaticTemplate]
    public class NoticeController : Controller
    {
        public ActionResult Index()
        {
            return View(new NoticeIndexModel());
        }

        public ActionResult GetPaged(DataTableParameter parameters)
        {
            using (var proxy = new ServiceProxy<IUserService>())
            {
                var pageInfo = proxy.Channel.GetNoticePaged(parameters.ToPagingFeature());

                return this.Store(pageInfo);
            }
        }
       
        [HttpPost]
        public ActionResult Delete(Guid[] ids)
        {
            Result res;
            using (var proxy = new ServiceProxy<IUserService>())
            {
                res = proxy.Channel.DeleteNotices(ids);
            }

            return this.JsonNet(res);
        }
    }
}